package com.lemon.ai.socket.packets.spiritgame.model.generator;

import java.util.List;

import com.lemon.ai.socket.packets.spiritgame.model.dto.Table;

public class KeyUtilGenerator extends AbstractGenerator {

	public KeyUtilGenerator() {
		super("KeyUtilClassTemp.txt");
	}

	public String generateClassName() {
		return super.prop.getProperty("dir")
				+ super.prop.getProperty("package").replace(".", "\\")
				+ "\\utils\\" + "KeyUtil.java";
	}

	public String generate(List<Table> tables) {
		StringBuilder getKeySets = new StringBuilder();
		StringBuilder changeKeySets = new StringBuilder();

//		for (Table t : tables) {
//			getKeySets.append("table2class.put(\"" + t.getName()+ "\", \"" + StringUtils.generateClassName(t.getName()) + "\");\r\t\t");
//			getKeySets.append("class2table.put(\"" + StringUtils.generateClassName(t.getName())+ "\", \"" + t.getName() + "\");\r\t\t");
//			
//			
//			
//			changeKeySets.append("columns.put(\"" + t.getName()+ "\", new HashSet<String>());\r\t\t");
//			for (Column c : t.getColumns()) {
//				changeKeySets.append("columns.get(\"" + t.getName()+ "\").add(\""+ c.getName() + "\");\r\t\t");
//			}
//		}
		
		return super.temp.
				replaceAll("GET_KEY_SETS", getKeySets.toString()).
				replaceAll("PACKAGE_NAME", super.prop.getProperty("package")).
				replaceAll("CHANGE_KEY_SETS", changeKeySets.toString())
				;
	}
}
